package com.ibix.controller;

import com.ibix.bean.User;
import com.ibix.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: outman
 * Date: 2017/7/7
 * Time: 下午9:21
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Controller
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/listUser")
    public ModelAndView listCategory() throws Exception {
        ModelAndView mav = new ModelAndView();
        List<User> cs= userService.list();

        // 放入转发参数
        mav.addObject("cs", cs);
        // 放入jsp路径
        mav.setViewName("listPerson");
        return mav;
    }
}
